using System;
using System.Data;
using Utils;
using Utils.DatabaseUtils;


namespace QLBH
{
public class tblKhoHangUI
{ 
	private int idKhoHang;
	public int IdKhoHang
	{
		get { return idKhoHang;}
		set { idKhoHang = value;}
	}

	private String tenKhoHang;
	public String TenKhoHang
	{
		get { return tenKhoHang;}
		set { tenKhoHang = value;}
	}

	private String diaChi;
	public String DiaChi
	{
		get { return diaChi;}
		set { diaChi = value;}
	}

	private String dienThoai;
	public String DienThoai
	{
		get { return dienThoai;}
		set { dienThoai = value;}
	}

	private String fax;
	public String Fax
	{
		get { return fax;}
		set { fax = value;}
	}

	private String email;
	public String Email
	{
		get { return email;}
		set { email = value;}
	}

	private int nguoiQuanLy;
	public int NguoiQuanLy
	{
		get { return nguoiQuanLy;}
		set { nguoiQuanLy = value;}
	}

	private String ghiChu;
	public String GhiChu
	{
		get { return ghiChu;}
		set { ghiChu = value;}
	}

	private DateTime ngayTao;
	public DateTime NgayTao
	{
		get { return ngayTao;}
		set { ngayTao = value;}
	}

	private bool hoatDong;
	public bool HoatDong
	{
		get { return hoatDong;}
		set { hoatDong = value;}
	}

	public tblKhoHangUI() {}

	public tblKhoHangUI(int idKhoHang, String tenKhoHang, String diaChi, String dienThoai, String fax, String email, int nguoiQuanLy, String ghiChu, DateTime ngayTao, bool hoatDong)
	 {
		this.idKhoHang = idKhoHang;
 		this.tenKhoHang = tenKhoHang;
 		this.diaChi = diaChi;
 		this.dienThoai = dienThoai;
 		this.fax = fax;
 		this.email = email;
 		this.nguoiQuanLy = nguoiQuanLy;
 		this.ghiChu = ghiChu;
 		this.ngayTao = ngayTao;
 		this.hoatDong = hoatDong;
 	}

	public int Add(String tenKhoHang, String diaChi, String dienThoai, String fax, String email, int nguoiQuanLy, String ghiChu, DateTime ngayTao, bool hoatDong)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblKhoHang_Add",tenKhoHang,diaChi,dienThoai,fax,email,nguoiQuanLy,ghiChu,ngayTao,hoatDong);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Update(int idKhoHang, String tenKhoHang, String diaChi, String dienThoai, String fax, String email, int nguoiQuanLy, String ghiChu, DateTime ngayTao, bool hoatDong)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblKhoHang_Update",idKhoHang,tenKhoHang,diaChi,dienThoai,fax,email,nguoiQuanLy,ghiChu,ngayTao,hoatDong);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Delete(int idKhoHang)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblKhoHang_Delete",idKhoHang);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int DeleteAll()
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblKhoHang_DeleteAll");
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public DataSet Get(int idKhoHang)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblKhoHang_Get",idKhoHang);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetAll()
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblKhoHang_GetAll");
			return result;
		}
		catch(Exception e) {return null; }
	}

} 
}
